<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>event.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_events_event.js.html">event.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2005 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview A base class for event objects.
<a name="line17"></a> *
<a name="line18"></a> */
<a name="line19"></a>
<a name="line20"></a>
<a name="line21"></a>goog.provide(&#39;goog.events.Event&#39;);
<a name="line22"></a>goog.provide(&#39;goog.events.EventLike&#39;);
<a name="line23"></a>
<a name="line24"></a>// goog.events.Event no longer depends on goog.Disposable. Keep requiring
<a name="line25"></a>// goog.Disposable here to not break projects which assume this dependency.
<a name="line26"></a>goog.require(&#39;goog.Disposable&#39;);
<a name="line27"></a>
<a name="line28"></a>
<a name="line29"></a>/**
<a name="line30"></a> * A typedef for event like objects that are dispatchable via the
<a name="line31"></a> * goog.events.dispatchEvent function. strings are treated as the type for a
<a name="line32"></a> * goog.events.Event. Objects are treated as an extension of a new
<a name="line33"></a> * goog.events.Event with the type property of the object being used as the type
<a name="line34"></a> * of the Event.
<a name="line35"></a> * @typedef {string|Object|goog.events.Event}
<a name="line36"></a> */
<a name="line37"></a>goog.events.EventLike;
<a name="line38"></a>
<a name="line39"></a>
<a name="line40"></a>
<a name="line41"></a>/**
<a name="line42"></a> * A base class for event objects, so that they can support preventDefault and
<a name="line43"></a> * stopPropagation.
<a name="line44"></a> *
<a name="line45"></a> * @param {string} type Event Type.
<a name="line46"></a> * @param {Object=} opt_target Reference to the object that is the target of
<a name="line47"></a> *     this event. It has to implement the {@code EventTarget} interface
<a name="line48"></a> *     declared at {@link http://developer.mozilla.org/en/DOM/EventTarget}.
<a name="line49"></a> * @constructor
<a name="line50"></a> */
<a name="line51"></a>goog.events.Event = function(type, opt_target) {
<a name="line52"></a>  /**
<a name="line53"></a>   * Event type.
<a name="line54"></a>   * @type {string}
<a name="line55"></a>   */
<a name="line56"></a>  this.type = type;
<a name="line57"></a>
<a name="line58"></a>  /**
<a name="line59"></a>   * Target of the event.
<a name="line60"></a>   * @type {Object|undefined}
<a name="line61"></a>   */
<a name="line62"></a>  this.target = opt_target;
<a name="line63"></a>
<a name="line64"></a>  /**
<a name="line65"></a>   * Object that had the listener attached.
<a name="line66"></a>   * @type {Object|undefined}
<a name="line67"></a>   */
<a name="line68"></a>  this.currentTarget = this.target;
<a name="line69"></a>};
<a name="line70"></a>
<a name="line71"></a>
<a name="line72"></a>/**
<a name="line73"></a> * For backwards compatibility (goog.events.Event used to inherit
<a name="line74"></a> * goog.Disposable).
<a name="line75"></a> * @deprecated Events don&#39;t need to be disposed.
<a name="line76"></a> */
<a name="line77"></a>goog.events.Event.prototype.disposeInternal = function() {
<a name="line78"></a>};
<a name="line79"></a>
<a name="line80"></a>
<a name="line81"></a>/**
<a name="line82"></a> * For backwards compatibility (goog.events.Event used to inherit
<a name="line83"></a> * goog.Disposable).
<a name="line84"></a> * @deprecated Events don&#39;t need to be disposed.
<a name="line85"></a> */
<a name="line86"></a>goog.events.Event.prototype.dispose = function() {
<a name="line87"></a>};
<a name="line88"></a>
<a name="line89"></a>
<a name="line90"></a>/**
<a name="line91"></a> * Whether to cancel the event in internal capture/bubble processing for IE.
<a name="line92"></a> * @type {boolean}
<a name="line93"></a> * @suppress {underscore} Technically public, but referencing this outside
<a name="line94"></a> *     this package is strongly discouraged.
<a name="line95"></a> */
<a name="line96"></a>goog.events.Event.prototype.propagationStopped_ = false;
<a name="line97"></a>
<a name="line98"></a>
<a name="line99"></a>/**
<a name="line100"></a> * Whether the default action has been prevented.
<a name="line101"></a> * This is a property to match the W3C specification at {@link
<a name="line102"></a> * http://www.w3.org/TR/DOM-Level-3-Events/#events-event-type-defaultPrevented}.
<a name="line103"></a> * Must be treated as read-only outside the class.
<a name="line104"></a> * @type {boolean}
<a name="line105"></a> */
<a name="line106"></a>goog.events.Event.prototype.defaultPrevented = false;
<a name="line107"></a>
<a name="line108"></a>
<a name="line109"></a>/**
<a name="line110"></a> * Return value for in internal capture/bubble processing for IE.
<a name="line111"></a> * @type {boolean}
<a name="line112"></a> * @suppress {underscore} Technically public, but referencing this outside
<a name="line113"></a> *     this package is strongly discouraged.
<a name="line114"></a> */
<a name="line115"></a>goog.events.Event.prototype.returnValue_ = true;
<a name="line116"></a>
<a name="line117"></a>
<a name="line118"></a>/**
<a name="line119"></a> * Stops event propagation.
<a name="line120"></a> */
<a name="line121"></a>goog.events.Event.prototype.stopPropagation = function() {
<a name="line122"></a>  this.propagationStopped_ = true;
<a name="line123"></a>};
<a name="line124"></a>
<a name="line125"></a>
<a name="line126"></a>/**
<a name="line127"></a> * Prevents the default action, for example a link redirecting to a url.
<a name="line128"></a> */
<a name="line129"></a>goog.events.Event.prototype.preventDefault = function() {
<a name="line130"></a>  this.defaultPrevented = true;
<a name="line131"></a>  this.returnValue_ = false;
<a name="line132"></a>};
<a name="line133"></a>
<a name="line134"></a>
<a name="line135"></a>/**
<a name="line136"></a> * Stops the propagation of the event. It is equivalent to
<a name="line137"></a> * {@code e.stopPropagation()}, but can be used as the callback argument of
<a name="line138"></a> * {@link goog.events.listen} without declaring another function.
<a name="line139"></a> * @param {!goog.events.Event} e An event.
<a name="line140"></a> */
<a name="line141"></a>goog.events.Event.stopPropagation = function(e) {
<a name="line142"></a>  e.stopPropagation();
<a name="line143"></a>};
<a name="line144"></a>
<a name="line145"></a>
<a name="line146"></a>/**
<a name="line147"></a> * Prevents the default action. It is equivalent to
<a name="line148"></a> * {@code e.preventDefault()}, but can be used as the callback argument of
<a name="line149"></a> * {@link goog.events.listen} without declaring another function.
<a name="line150"></a> * @param {!goog.events.Event} e An event.
<a name="line151"></a> */
<a name="line152"></a>goog.events.Event.preventDefault = function(e) {
<a name="line153"></a>  e.preventDefault();
<a name="line154"></a>};
</pre>


</body>
</html>
